<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
    <script src="../react.development.js"></script>
    <script src="../react-dom.development.js"></script>
    <title>Document</title>
</head>

<body>
    <div id="root"></div>
    <script type="text/babel">
        //class 组件
        class Welcome extends React.Component {
            render() {
                return <div>
                    <h2>{this.props.name}</h2>
                    <h1>ReactJs is almost perfect but reaching the limit if the code is becoming huge</h1>
                </div>
            }
        }

        // 函数组件，只接受一个 props参数
        // function Welcome(props) {
        //     return <h1>Hello, {props.name}</h1>;
        // }

        // class组件和函数组件是等价的，根据场景或需要用一种即可

        const element = <Welcome name="Sara" />;
        ReactDOM.render(
            element,
            document.getElementById('root')
        );
    </script>
</body>

</html>